package com.book.system.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.book.common.annotation.group.InsertGroup;
import com.book.common.core.domain.BaseEntity;
import com.book.system.domain.vo.AppUserVo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.NotBlank;

/**
 * @author Bigboss
 * @create 2024-11-10 14:53
 */
@ApiModel("用户评论内容信息记录表")
@TableName("comment")
public class Comment extends BaseEntity {

    /**
     * 主键
     */
    @ApiModelProperty("主键")
    @TableId(value = "id",type = IdType.ASSIGN_ID)
    private String id;


    /**
     * 评论人id
     */
    @ApiModelProperty("评论人id")
    private String appUserId;


    /**
     * 书籍id
     */
    @ApiModelProperty("书籍id")
    @NotBlank(message = "请选择要评论的书籍",groups = {InsertGroup.class})
    private String bookId;


    /**
     * 评论内容
     */
    @ApiModelProperty("评论内容")
    @NotBlank(message = "请输入评论内容",groups = {InsertGroup.class})
    private String content;

    /**
     * 评论对应的书籍信息
     */
    @TableField(exist = false)
    private Book book;


    /**
     * 评论人信息
     */
    @TableField(exist =false)
    private AppUserVo user;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getAppUserId() {
        return appUserId;
    }

    public void setAppUserId(String appUserId) {
        this.appUserId = appUserId;
    }

    public String getBookId() {
        return bookId;
    }

    public void setBookId(String bookId) {
        this.bookId = bookId;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Book getBook() {
        return book;
    }

    public void setBook(Book book) {
        this.book = book;
    }

    public AppUserVo getUser() {
        return user;
    }

    public void setUser(AppUserVo user) {
        this.user = user;
    }

    @Override
    public String toString() {
        return "Comment{" +
                "id='" + id + '\'' +
                ", appUserId='" + appUserId + '\'' +
                ", bookId='" + bookId + '\'' +
                ", content='" + content + '\'' +
                '}';
    }
}
